package com.qf.team2.netdisc.service.impl;

import com.qf.team2.netdisc.common.pojo.entity.CancelOrder;
import com.qf.team2.netdisc.dao.CancelMapper;
import com.qf.team2.netdisc.service.CancelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author QWER
 */
@Service
public class CancelOrderService implements CancelService {
    @Autowired
    private CancelMapper cancelMapper;

    @Override
    public int insertVip(Integer userId) {
        int i = cancelMapper.insertCancel(userId);
        int i1 = cancelMapper.updateUserVip(userId);
        if(i==1 && i1==1){
            return 0;
        }else {
            return 1;
        }

    }

    @Override
    public Long cancelVip(Long cancelId,Long userId) {
        cancelMapper.updateCancelVip(cancelId);
        cancelMapper.updateCancelUserVip(userId);
        return 0L;
    }

    @Override
    public List<CancelOrder> selectOrder() {
        return cancelMapper.selectCancel();
    }


}
